<?php $this->load->module('hm/index/header', $common); ?>
<link rel="stylesheet" href="<?php echo URLPRE; ?>static/hm/css/order_detail.css" type="text/css">
<div class="page active">
    <header class="list-head J_header">
        <a class="back J_back" href="javascript:history.back();">首页</a>
        <div class="addr J_addr" style="visibility: hidden">
            <div class="area">
                <i class="location"></i>金轮大厦<i class="arr-dowm"></i></div>
        </div>
        <!--  <a class="search J_search" href="http://m.dianping.com/waimai/mindex?from=m_nav_5_waimai#!search/source=index"><i class="search-icon"></i></a>-->
        <script type="text/javascript" src="<?php echo URLPRE; ?>static/template/default/mobile/js/layer/layer.js"></script>

    </header>
    <div class="shop-list index-shop-list J_list_wrap" >

        <?php if ($list): ?>
            <?php foreach ($list as $val): ?>
                <a href="<?php echo $val['edit_url']; ?>">
                    <div class="about about-new">
                        <div class="shopname">
                            <span class="tit new-tit"><?php echo $val['rstr']; ?></span>
                            <div class="icon">
                                <span class="brand"><?php echo $val['cat_type_name']; ?></span>
                            </div>

                        </div>
                        <div class="info">
                            <span class="monthsold">入住:<?php echo $val['start_date']; ?></span>&nbsp;/&nbsp;<span class="monthsold">离店:<?php echo $val['end_date']; ?></span>
                            <div class="icon">
                                <span class="platformdel"><?php echo $val['order_status_name']; ?>
                                    /<?php echo $val['pay_status_name']; ?></span>
                            </div>
                        </div>
                        <div class="intro">
                            <span class="minprice">订单金额: <span class="price-orange"><?php echo $val['order_account']; ?></span></span><span class="deliveryprice"><?php echo $val['number']; ?>
                                人 </span><!--<span class="time">41分钟</span>-->
                        </div>
                    </div>
                </a>
            <?php endforeach; ?>
        <?php endif; ?>


        <div class="link-btn-wrap">  <a class="link-btn J_view_more" href="javascript:;">查看更多</a></div>

    </div>
    <script>

        var getUrl = '<?php echo site_url('hm/order/order_list');?>';
        var nextPage = '<?php echo $nowindex + 1;?>';
        $(function () {

            $(window).scroll(function () {

                totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());
                if ($(document).height() <= totalheight) {

                    $.ajax({
                        url: getUrl + '/' + nextPage+'?is_ajax=1',
                        cache: false,
                        dataType: 'json',
                        type: 'GET',
                        beforeSend:function () {
                            layer.msg('加载中...',{time:600});
                            $('.J_view_more').text('加载中...');
                        },
                        success: function (data) {
                            if (data.length > 0) {
                                var html = '';
                                for (var i = 0; i < data.length; i++) {
                                    var l = data[i];

                                    html += '<a href="' + l.edit_url + '">' +
                                        '<div class="about about-new">' +
                                        '<div class="shopname">' +
                                        '<span class="tit new-tit">' + l.rstr + '</span>' +
                                        '<div class="icon">' +
                                        '<span class="brand">' + l.cat_type_name + '</span></div>' +
                                        '</div>' +
                                        '<div class="info">' +
                                        '<span class="monthsold">入住:' + l.start_date + '</span>&nbsp;/&nbsp;<span class="monthsold">离店:' + l.end_date + '</span>' +
                                        '<div class="icon">' +
                                        '<span class="platformdel">' + l.order_status_name + '/' + l.pay_status_name + '</span>' +
                                        '</div>' +
                                        '</div>' +
                                        '<div class="intro">' +
                                        '<span class="minprice">订单金额: <span class="price-orange">' + l.order_account + '</span></span><span class="deliveryprice">' + l.number + '人 </span> </div></div></a>';
                                }
                                $(html).insertBefore('.J_view_more');
                                nextPage++;
                                $('.J_view_more').text('加载更多');
                                return false;
                            } else {

                                $('.J_view_more').text('没有更多了');
                                layer.msg('没有更多了');
                            }
                        }
                    });



                }


            })
        })
    </script>
    <?php $this->load->module('hm/index/footer',$common); ?>
